﻿using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A2DFramework.QueueService.Providers.RabbitMQ
{
    public static class RabbitMQFactory
    {
        public static IModel CreateRabbitMQChannel()
        {
            ConnectionFactory rmqConnFactory = new ConnectionFactory()
            {
                HostName = QueueConfiguration.QueueConfiguration.RabbitMQSettings.Server,
                UserName = QueueConfiguration.QueueConfiguration.RabbitMQSettings.User,
                Password = QueueConfiguration.QueueConfiguration.RabbitMQSettings.Password,
                Port = QueueConfiguration.QueueConfiguration.RabbitMQSettings.Port,
            };
            IConnection conn = rmqConnFactory.CreateConnection();
            return conn.CreateModel();
        }
    }
}
